package com.xiaomuwu.android.ui.home

import androidx.lifecycle.MutableLiveData
import androidx.lifecycle.Transformations
import androidx.lifecycle.ViewModel
import com.xiaomuwu.android.logic.Repository
import com.xiaomuwu.android.logic.model.ForReleUser
import com.xiaomuwu.android.logic.model.ForUser
import com.xiaomuwu.android.logic.model.User

class UserViewModel:ViewModel(){

    private val toUserLiveData=MutableLiveData<ForUser>()

//    private val toReleUserLiveData=MutableLiveData<ForReleUser>()

    val userList=ArrayList<User>()

    var userLiveData=Transformations.switchMap(toUserLiveData){forUser->
        Repository.getUser(forUser)
    }

//    var releUserLiveData=Transformations.switchMap(toReleUserLiveData){forReleUser->
//        Repository.getReleUser(forReleUser)
//    }

    fun getUserLiveData(forUser: ForUser){
        toUserLiveData.value=forUser
    }

//    fun getReleUserLiveData(forReleUser: ForReleUser){
//        toReleUserLiveData.value=forReleUser
//    }

}